#!/usr/bin/env python

#import public lib
import wx
import os
import os.path
import string
import logging

#import private lib
from CommonClass import MessageBox

def msg(message):
    
    app = wx.PySimpleApp()
    
    frame = MessageBox(None, -1, message)
    
    sep = os.path.sep
    ib = wx.IconBundle()
    ib.AddIconFromFile("dat" + sep + "warn.ico",wx.BITMAP_TYPE_ANY)
    frame.SetIcons(ib)
    
    frame.Show()
    
    app.MainLoop()

def show_profile_list():
    
    '''list the ini files in the profile directory'''
    
    files = os.listdir('profiles')
    
    for f in files:
        
        if f.find('.ini') != -1:
            
            print string.rstrip(f, '.ini')
        

def log(message):
    
    #SET LOG CONFIG
    logger = logging.getLogger('perf')
    hdlr = logging.FileHandler('perf.log')
    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
    hdlr.setFormatter(formatter)
    logger.addHandler(hdlr)
    logger.setLevel(logging.INFO)
    
    #ADD THE MESSAGE TO THE LOG FILE
    logger.info(message)

def show_help_message():
    
    '''show the message of help'''
    
    help_msg = '''
    
    This is a power tool for performance tester
    
    '''
    
    print help_msg
    